import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../routes/xin_he_routes.dart';
import '../../../utils/xh_styles.dart';
import '../../../utils/xin_he_image.dart';
import 'xin_he_apply_sale_after_logic.dart';

enum SaleAfterType {
  backMoneyAndGoods,
  backMoney,
  changeGoods,
  unknown
}

class XinHeApplySaleAfterPage extends StatelessWidget {
  XinHeApplySaleAfterPage({Key? key}) : super(key: key);

  final logic = Get.put(XinHeApplySaleAfterLogic());
  final state = Get.find<XinHeApplySaleAfterLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
            onPressed: (){
              Get.back();
            },
            icon: Container(
              padding: const EdgeInsets.only(left: 7),
              alignment: Alignment.centerLeft,
              child: const XinHeAssetImage(
                'assets/images/home/app_back_3.png',
                width: 9.5,
                height: 17,
                fit: BoxFit.cover,),
            )
        ),
        backgroundColor: Colors.white,
        shadowColor: Colors.transparent,
        title: Text('申请售后',style: TextStyle(color:XinHeColor('#222222'),fontSize: 17,fontWeight: FontWeight.w600)),
        centerTitle: true,
      ),
      body: Column(
        // padding: EdgeInsets.zero,
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          const SizedBox(height: 15,),

          ///退换商品信息
          Container(
            width: Get.width,
            height: 170,
            color: Colors.white,
            padding: const EdgeInsets.symmetric(horizontal: 15),
            child: Column(children: [
              Container(
                  alignment: Alignment.centerLeft,
                  height: 44,
                  child: Text('退换商品',style: TextStyle(color: XinHeColor('#333333'),fontSize: 14,))),
              Container(
                color: Colors.white,
                width: Get.width,
                height: 80,
                child:  Row(
                  children: [

                    const Padding(
                      padding:  EdgeInsets.only(left: 0,top: 0,right: 15,bottom: 0),
                      child: XinHeAssetImage('assets/images/home/tmp.png',width: 80,height: 80,fit: BoxFit.fill,),
                    ),

                    ///描述与价格数量
                    Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [

                        SizedBox(
                            width:Get.width-30-80-15,
                            child: Text('一级冷榨有机野山茶籽油500ML级冷榨有机野iii',maxLines: 2,softWrap: true,style: TextStyle(color: XinHeColor('#222222'),fontSize: 14,fontWeight: FontWeight.bold),)
                        ),

                        SizedBox(
                          width:Get.width-30-80-15,
                          height: 23,
                          child: Row(
                            children: [

                              RichText(
                                  text: TextSpan(children: [
                                    ///￥
                                    TextSpan(
                                      text: '￥',
                                      style: TextStyle(
                                        color: XinHeColor('#E84128'),
                                        fontSize: 9,
                                        fontWeight: FontWeight.w500,
                                      ),
                                    ),

                                    ///
                                    TextSpan(
                                      text: '198',
                                      style: TextStyle(
                                        color: XinHeColor('#E84128'),
                                        fontSize: 16,
                                        fontWeight: FontWeight.w500,
                                      ),
                                    ),

                                  ]
                                  )),
                              const Spacer(),

                              Text('x7',style: TextStyle(color: XinHeColor('#8B9191'), fontSize: 12, fontWeight: FontWeight.w500,)
                              ),
                              const SizedBox(width: 0,)

                            ],
                          ),
                        )

                      ],)


                  ],
                ),
              ),

              Container(
                height: 46,
                alignment: Alignment.centerLeft,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    RichText(text: TextSpan(children: [
                      TextSpan(text:'合计',style: TextStyle(color: XinHeColor('#555555'),fontSize: 12)),
                      TextSpan(text: '￥',style: TextStyle(color: XinHeColor('#E33F3F'),fontSize: 12)),
                      TextSpan(text: '1500.80',style: TextStyle(color: XinHeColor('#E33F3F'),fontSize: 15))
                    ])),
                  ],),
              ),

            ],),

          ),

          ///选择服务类型
          Container(
            padding: EdgeInsets.only(top: 0,left: 15,right: 15),
            margin: EdgeInsets.only(top: 15),
            color: Colors.white,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(height: 8,),
                Container(
                  height: 212.5-59*3-10,
                  child: Text('选择服务类型',style: TextStyle(color: XinHeColor('#333333'),fontSize: 14,fontWeight: FontWeight.w600),),
                ),

                ///我要退款(无需退货)
                GestureDetector(
                  onTap: (){
                    Get.toNamed(XinHeRoutes.applyBackMoneyAndGoods,arguments: SaleAfterType.backMoney);
                  },
                  child: Container(
                     height: 59,
                    color: Colors.white,
                    child: Row(children: [
                  const XinHeAssetImage('assets/images/mine/after_back_money.png',width: 23,height: 22,),
                  const SizedBox(width: 5,),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                    Text('我要退款(无需退货)',style: TextStyle(color: XinHeColor('#222222'),fontSize: 14,fontWeight: FontWeight.w600),),
                    Text('没收到货，或与卖家协商同意不用退货只退款',style: TextStyle(color: XinHeColor('#666666'),fontSize: 14),),

                  ],),

                  Spacer(),
                  const XinHeAssetImage('assets/images/cart/pay_arrow.png',width: 6,height: 10,),

              ],),),
                ) ,
                ///我要退货退款
                GestureDetector(
                  onTap: (){
                    Get.toNamed(XinHeRoutes.applyBackMoneyAndGoods,arguments: SaleAfterType.backMoneyAndGoods);
                  },
                  child: Container(
                    height: 59,
                    color: Colors.white,
                    child: Row(children: [
                      const XinHeAssetImage('assets/images/mine/after_back_money.png',width: 23,height: 22,),
                      SizedBox(width: 8,),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text('我要退货退款',style: TextStyle(color: XinHeColor('#222222'),fontSize: 14,fontWeight: FontWeight.w600),),
                          Text('收到货，需要退还收到的货物',style: TextStyle(color: XinHeColor('#666666'),fontSize: 14),),

                        ],),

                      Spacer(),
                      const XinHeAssetImage('assets/images/cart/pay_arrow.png',width: 6,height: 10,),

                    ],),),
                ) ,

                ///我要换货
                GestureDetector(
                  onTap: (){
                    Get.toNamed(XinHeRoutes.applyBackMoneyAndGoods,arguments: SaleAfterType.changeGoods);

                  },
                  child: Container(
                    height: 59,
                    color: Colors.white,
                    child: Row(children: [
                      XinHeAssetImage('assets/images/mine/after_back_money.png',width: 23,height: 22,),
                      SizedBox(width: 8,),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text('我要换货',style: TextStyle(color: XinHeColor('#222222'),fontSize: 14,fontWeight: FontWeight.w600),),
                        ],),

                      Spacer(),
                      const XinHeAssetImage('assets/images/cart/pay_arrow.png',width: 6,height: 10,),

                    ],),),
                )  ,
                const SizedBox(height: 5,)






              ],),)



        ],),
    );
  }
}
